<?php
	
	$pages = array
			(
				"login"                   => "pages/login.php",
				"statistica"              => "pages/statistica.php",
				"home"                    => "pages/home.php",
				"materiale"               => "pages/materiale.php",
				"comentarii"              => "pages/comentarii.php",
				"comentarii_stiri"        => "pages/comentarii_stiri.php",
				"comentarii_intrebare"    => "pages/comentarii_intrebare.php",
				"comentarii_concurs"      => "pages/comentarii_concurs.php",
				"stiri"                   => "pages/stiri.php",
				"intrebarea_zilei"        => "pages/intrebarea_zilei.php",
				"newsletter"              => "pages/newsletter.php",
				"utilizatori"             => "pages/utilizatori.php",
				"sondaj"                  => "pages/sondaj.php",
				"info_home"               => "pages/infohome.php"
			);
			
	$page = "home";

	( !empty($_GET['page']) ) ? ( $page = $_GET['page'] ) : ( $page = "home" );
	
	if ( empty( $_SESSION["admin_logged"] ) || $_SESSION["admin_logged"] != "true" ) $page = "login";
	
	if( array_key_exists( $page, $pages ) )
	{
		$request = $pages[$page];
		if( is_file( $request ) )
			include( $request );
		else
			echo ('<div class="ui-state-error ui-corner-all" style="padding: 0pt 0.7em;"><p>' . "Pagina indisponibila momentan!</p>" . "</div>");
	}
	else
		echo ('<div class="ui-state-error ui-corner-all" style="padding: 0pt 0.7em;"><p>' . "Pagina indisponibila momentan!" . "</p></div>");
?>